package cn.itcast.feign.clients.fallback;

import cn.itcast.feign.clients.UserClient;
import cn.itcast.feign.pojo.User;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

//@Component
public class UserClientFallback2 implements FallbackFactory<UserClient> {

    @Override
    public UserClient create(Throwable throwable) {
        return new UserClient() {
            @Override
            public User findById(Long id) {
                User user = new User();
                user.setId(0L);
                user.setUsername("默认用户");
                user.setAddress("默认地址");
                return user;

            }
        };
    }
}
